package cn.edu.nuc.ssm.service.impl;

import cn.edu.nuc.ssm.dao.AccountMapper;
import cn.edu.nuc.ssm.entity.Account;
import cn.edu.nuc.ssm.entity.AccountTransfer;
import cn.edu.nuc.ssm.service.DefaultTransferService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * Created by Administrator on 2017/5/19.
 */
@Service
public class DefaultTransferServiceImpl implements DefaultTransferService{

    @Autowired
    private AccountMapper accountMapper;


    @Override
    public AccountTransfer findDefaultTranfer(Integer uid) {

        Account xiejinAccount = accountMapper.findbyUidAndname(uid, "现金");
        Account yinfuAccount = accountMapper.findbyUidAndname(uid, "应付款项");

        AccountTransfer accountTransfer = new AccountTransfer();

        accountTransfer.setUid(uid);
        accountTransfer.setAccountInId(xiejinAccount.getId());
        accountTransfer.setAccountOutId(yinfuAccount.getId());


        return accountTransfer;
    }
}
